/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package thienphuc.patient.bo.impl;

import java.util.List;
import thienphuc.patient.bo.QuyenBO;
import thienphuc.patient.dao.QuyenDAO;
import thienphuc.patient.dao.impl.QuyenDAOImpl;
import thienphuc.patient.dto.PhongBan;
import thienphuc.patient.dto.Quyen;

/**
 *
 * @author QuocDat
 */
public class QuyenBOImpl implements QuyenBO {

    private QuyenDAO quyenDAO;
    
    public QuyenBOImpl() {
        this.quyenDAO = new QuyenDAOImpl(Quyen.class);
    }
    
    public List<Quyen> getAll() throws Exception {
        return this.quyenDAO.findAll();
    }

    public Quyen getById(int quyenId) throws Exception {
        return this.quyenDAO.findById(quyenId);
    }

    public List<Quyen> getByTenQuyen(String tenQuyen) throws Exception {
        return this.quyenDAO.findByTenQuyen(tenQuyen);
    }

    public List<Quyen> getByTrangThai(boolean trangThai) throws Exception {
        return this.quyenDAO.findByTrangThai(trangThai);
    }

    public List<Quyen> getByPhongBan(PhongBan phongBan) throws Exception {
        return this.quyenDAO.findByPhongBan(phongBan);
    }

    public boolean insertQuyen(Quyen quyen) throws Exception {
        return this.quyenDAO.save(quyen);
    }

    public boolean updateQuyen(Quyen quyen) throws Exception {
        return this.quyenDAO.update(quyen);
    }
    
}
